//
//  UICollectionViewCellDataSource.swift
//  iPhone
//
//  Created by Toj on 5/24/23.
//

import UIKit

/**
 * UICollectionViewCell 协议
 * 给CollectionViewCell提供数据源用的
 */
protocol UICollectionViewCellDataSource {
    var delegate: UICollectionViewCellDelegate? { get set }
    var dataModel: UICollectionViewCellModelProtocol? { set get }
}

extension UICollectionViewCellDataSource {
    
    var delegate: UICollectionViewCellDelegate? {
        get { return nil }
        set {  }
    }
}

protocol UICollectionViewCellDelegate: NSObjectProtocol {
    func collectionViewReloadData()
    func collectionViewReloadCell(_ cell: UICollectionViewCell)
    func collectionViewDidSelected(at indexPath: IndexPath)
    func collectionViewInvalidateLayout()
    func invalidateLayoutItems(at indexPaths: [IndexPath])
    func invalidateLayoutCell(_ cell: UICollectionViewCell)
}

extension UICollectionViewCellDelegate {
    func collectionViewReloadData() { }
    func collectionViewReloadCell(_ cell: UICollectionViewCell) { }
    func collectionViewDidSelected(at indexPath: IndexPath) { }
    func collectionViewInvalidateLayout() { }
    func invalidateLayoutItems(at indexPaths: [IndexPath]) { }
    func invalidateLayoutCell(_ cell: UICollectionViewCell) { }
}
